import request from '@/utils/request'

// 查询流程验证列表
export function listTestflow(query) {
  return request({
    url: '/user/testflow/list',
    method: 'get',
    params: query
  })
}

// 查询流程验证详细
export function getTestflow(id) {
  return request({
    url: '/user/testflow/' + id,
    method: 'get'
  })
}

// 新增流程验证
export function addTestflow(data) {
  return request({
    url: '/user/testflow',
    method: 'post',
    data: data
  })
}

// 修改流程验证
export function updateTestflow(data) {
  return request({
    url: '/user/testflow',
    method: 'put',
    data: data
  })
}

// 删除流程验证
export function delTestflow(id) {
  return request({
    url: '/user/testflow/' + id,
    method: 'delete'
  })
}


// 启动流程
export function startTestflow(id,flowId) {
  var _data = {};
  return request({
    url: '/user/testflow/startflow?id=' + id+"&flowId="+flowId,
    method: 'post',
    data: _data
  })
}


// 启动流程
export function getFlowTasks() {
  var _data = {};
  return request({
    url: '/user/testflow/getTasks',
    method: 'post',
    data: _data
  })
}


// 获取流程图
export function viewFlowDiagram(businessKey) {
  return request({
    url: '/user/testflow/flowDiagram?businessKey='+businessKey,
    method: 'get',
    responseType: "blob"
  })
}


// 办理任务
export function completeFlowTask(businessKey) {
  var _data = {};
  return request({
    url: '/user/testflow/completeTask?businessKey='+businessKey,
    method: 'put',
    data: _data
  })
}
